<%-- 
    Document   : alterar
    Created on : 08/12/2013, 02:23:33
    Author     : WellFau
--%>

<%@page import="adocao.OracleConnector"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <form action="" method="POST">
            <table>
                <%
                    String campos = "";
                    try{
                        for(Object[] reg: OracleConnector.getQuery("select * from usuario where cd_usuario="+session.getAttribute("id"))){
                            campos+="<tr>";
                            campos+="<td>";
                            campos+="<tr><td>NOME:</td><td><input type='text' name='nome' value='"+reg[1]+"'></td></tr>";
                            campos+="<tr><td>IDADE:</td><td><input type='text' name='idade' value='"+reg[2]+"'></td></tr>";
                            campos+="<tr><td>EMAIL</td><td><input type='email' name='email' value='"+reg[3]+"'></td></tr>";
                            campos+="<tr><td>R.G.</td><td><input type='text' name='rg' value='"+reg[4]+"'></td></tr>";
                            campos+="<tr><td colspan='2'><input type='submit' value='ALTERAR'></td></tr>";
                        }
                    }catch(Exception e){}
                %>
            </table>
        </form>
        <%

            if(request.getParameter("nome")!=null){
                String sql = "UPDATE usuario set nm_usuario ='"+request.getParameter("nome")+"',"
                        + "qt_idade_usuario ="+request.getParameter("idade")+","
                        + "nm_email_usuario ='"+request.getParameter("email")+"',"
                        + "cd_registro_geral_usuario = "+request.getParameter("rg")+""
                        + "WHERE nm_usuario='"+session.getAttribute("usuario")+"'";
            }
        %>
    </body>
</html>
